package org.example;

/**
 * @author zhupanlin
 * @version 1.0
 * @description: TODO
 * @date 2024/2/27 15:45
 */
public class Father {
    int x = 10;
    
    public Father(){
        this.print();
        x = 20;
    }
    
    public void print(){
        System.out.println("Father = " + x);
    }
    
}

class Son extends Father{
    int x = 30;
    
    public Son(){
        this.print();
        x = 40;
    }
    
    @Override
    public void print(){
        System.out.println("Son = " + x);
    }
    
}

class Test{
    public static void main(String[] args) {
        Father father = new Son();
        System.out.println("father.x = " + father.x);
    }
}

